package com.biodiv.miracle.web.listener;

import com.biodiv.miracle.event.core.EventListener;
import com.biodiv.miracle.event.ContextRefreshedEvent;
import com.biodiv.miracle.web.context.ServletWebServerApplicationContext;

/**
 * @Author: tianquan
 * @CreateTime: 2025-05-27  09:14
 * @Description: 容器初始化后监听器
 */
public class ServletInitEventListener implements EventListener<ContextRefreshedEvent> {

    @Override
    public void onEvent(ContextRefreshedEvent event) {
        // 初始化web
        Object source = event.getSource();
        if (source instanceof ServletWebServerApplicationContext servletWebServerApplicationContext){
            servletWebServerApplicationContext.initDispatcherServlet();
        }
    }

}
